package com.erclab.internal.xpresso.unittests.application;

import com.erclab.internal.xpresso.Application;
import com.erclab.internal.xpresso.conf.Settings;
import com.erclab.internal.xpresso.exceptions.ApplicationException;
import com.erclab.internal.xpresso.exceptions.DirectoryException;
import com.erclab.internal.xpresso.security.User;

import junit.framework.TestCase;

public class ApplicationTest extends TestCase {

	protected Application xpresso = null;
	protected User user = null;
	
	protected void setUp() throws Exception {
		super.setUp();
		try {
			xpresso = new Application();
		} catch(ApplicationException e){
			fail("Create Application failed: " + e.toString());
		}
		try {
			user = new User();
			Settings.getUserDirectory().loadUserBean(user);
		} catch (DirectoryException e) {
			fail();
			e.printStackTrace();
		}
	}
	
	public void testCreateApplication(){
		System.out.println("testCreateApplication() -------------------------");
		assertTrue(xpresso.getApplicationName() != null);
		assertTrue(xpresso.getApplicationDescription() != null);
		assertTrue(Settings.getAdminMode());
		
		System.out.println("ApplicationName: " + xpresso.getApplicationName());
		System.out.println("ApplicationDescription: " + xpresso.getApplicationDescription());
		
	}
	
}
